package com.atguigu.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * Date:2020/9/16
 * Author:ybc
 * Description:
 */
public class TestFilter implements Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
        chain.doFilter(req, resp);
    }

    public void init(FilterConfig config) throws ServletException {
        //获取filter的友好名称
        String filterName = config.getFilterName();
        System.out.println("filter的友好名称-->"+filterName);
        //获取filter的初始化参数
        String testFilterParam = config.getInitParameter("testFilterParam");
        System.out.println("filter的初始化参数-->"+testFilterParam);
        //获取ServletContext
        ServletContext servletContext = config.getServletContext();
    }

}
